home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr44 / modex32w.zip / MODEX32W.H < prev    next >
C/C++ Source or Header  |  1995-02-21  |  5KB  |  127 lines

  1. /*  Here are Michael Abrash's XMODE routines, converted to 32 bit
  2.     protected mode, currently all tested for PMC extender.
  3.  
  4.     The only functions not yet tested are
  5.         CopyScreenToScreenMaskedX
  6.         CreateAlignedMaskedImageX  (2)
  7.  
  8.     Note that (2) uses memory allocation routines specified to PMC
  9.     and hence won't link with BC/WC ...  But the ASM code is
  10.     changeable and you can modify the allocation calls to
  11.     whatever you need and reassemble.
  12.  
  13.     Also note that (2) was originally and someone compiled to asm
  14.     using BCC32 for me.  I will include the C file, with the header
  15.     for its use for anyone who needs them and prefers to make the
  16.     changes to the C code.
  17.  
  18.     Note that I have added some palette functions, two in fact,
  19.     and also modified the ShowPage to work with smooth vertical
  20.     and horizontal scrolling.  In addition I moved some static data
  21.     to global space to save a few bytes of space.
  22.  
  23.     In addition you must be using Tran's PMC/PMODE Dos Extender
  24.     for these functions since I haven't converted them for
  25.     DOS4GW yet.  I have not yet decided yet if I will or not
  26.     and will make no promises towards this cause. :)
  27.  
  28.     Disclaimer: The conversion may not be the most optimal. Further
  29.     I will not be responsible for any damaging consequences of using
  30.     this, and I assume neither will Michael Abrash whose routines
  31.     they were before the conversion process.
  32.  
  33.     This is released to FreeWare, and as such no cost is attached to
  34.     product.  Please mention appropriate copyrights when using these
  35.     routines and give credit to where it's due.
  36.  
  37.     (c) 1994 Kumanan Yogaratnam, all changes made.
  38.  
  39.     Note: If any of you out there is able to optimize this better,
  40.     then please let me know at kyogarat@chat.carleton.ca where
  41.     I will reside for atleast the next four years.
  42. */
  43.  
  44. /* MASKIM.H: structures used for storing and manipulating masked
  45.    images */
  46.  
  47. /* Describes one alignment of a mask-image pair */
  48.  
  49. typedef struct {
  50.    int ImageWidth; /* image width in addresses in display memory (also
  51.                       mask width in bytes) */
  52.    unsigned int ImagePtr; /* offset of image bitmap in display mem */
  53.    char *MaskPtr;  /* pointer to mask bitmap */
  54. } AlignedMaskedImage;
  55.  
  56. /* Describes all four alignments of a mask-image pair */
  57.  
  58. typedef struct {
  59.    AlignedMaskedImage *Alignments[4]; /* ptrs to AlignedMaskedImage
  60.                                       structs for four possible destination 
  61.                                       image alignments */
  62. } MaskedImage;
  63.  
  64.  
  65. #pragma aux ReadPixelX "_*" parm []
  66. #pragma aux FillPatternedX "_*" parm []
  67. #pragma aux FillRectangleX "_*" parm []
  68. #pragma aux CopySystemToScreenX "_*" parm []
  69. #pragma aux CopySystemToScreenMaskedX "_*" parm []
  70. #pragma aux Set320x240Mode "_*" parm []
  71. #pragma aux ResetModeX "_*" parm []
  72. #pragma aux CopyScreenToScreenX "_*" parm []
  73. #pragma aux CopyScreenToScreenMaskedX "_*" parm []
  74. #pragma aux ShowPage "_*" parm []
  75. #pragma aux WritePixel "_*" parm []
  76. #pragma aux SetAllPalette "_*" parm []
  77. #pragma aux SetIndexedPalette "_*" parm []
  78.  
  79. unsigned int ReadPixelX(int X, int Y, unsigned int PageBase);
  80.  
  81. void FillPatternedX(int StartX, int StartY, int EndX, int EndY,
  82.    unsigned int PageBase, char* Pattern);
  83.  
  84. void FillRectangleX(int StartX, int StartY, int EndX, int EndY,
  85.    unsigned int PageBase, int Color);
  86.  
  87. void CopySystemToScreenX(int SourceStartX, int SourceStartY,
  88.    int SourceEndX, int SourceEndY, int DestStartX,
  89.    int DestStartY, char* SourcePtr, unsigned int DestPageBase,
  90.    int SourceBitmapWidth, int DestBitmapWidth);
  91.  
  92. void CopySystemToScreenMaskedX(int SourceStartX,
  93.    int SourceStartY, int SourceEndX, int SourceEndY,
  94.    int DestStartX, int DestStartY, char * SourcePtr,
  95.    unsigned int DestPageBase, int SourceBitmapWidth,
  96.    int DestBitmapWidth, char * MaskPtr);
  97.  
  98. unsigned int CreateAlignedMaskedImage(MaskedImage * ImageToSet,
  99.    unsigned int DispMemStart, char * Image, int ImageWidth,
  100.    int ImageHeight, char * Mask);
  101.  
  102. void Set320x240Mode(unsigned scrwidth);
  103.  
  104. void ResetModeX ();
  105.  
  106. unsigned int ReadPixelX(int X, int Y, unsigned int PageBase);
  107.  
  108. void CopyScreenToScreenX(int SourceStartX, int SourceStartY,
  109.    int SourceEndX, int SourceEndY, int DestStartX,
  110.    int DestStartY, unsigned int SourcePageBase,
  111.    unsigned int DestPageBase, int SourceBitmapWidth,
  112.    int DestBitmapWidth);
  113.  
  114. void CopyScreenToScreenMaskedX(int SourceStartX,
  115.    int SourceStartY, int SourceEndX, int SourceEndY,
  116.    int DestStartX, int DestStartY, MaskedImage * Source,
  117.    unsigned int DestPageBase, int DestBitmapWidth);
  118.  
  119. void ShowPage(unsigned x, unsigned y);
  120.  
  121. void WritePixelX(int X, int Y, unsigned int PageBase, int Color);
  122.  
  123. void SetAllPalette (char *pbuf);
  124.  
  125. void SetIndexedPalette (int start, int endpal, char *pbuf);
  126.  
  127.